home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Ham⁄GPS / SoftKiss.src.1.8 Folder / SoftKiss.src.1.8.sit / SoftKiss.src.1.8 / docs / KISSTNC.MS < prev    next >
Text File  |  1992-05-11  |  18KB  |  434 lines

  1. .\" kisstnc.ms -- submitted to the sixth ARRL computer networking
  2. .\"              conference, August 1987.
  3. .\" to format, use "eqn kisstnc.ms | tbl | troff -ms"
  4. .EQ
  5. delim $$
  6. .EN
  7. .\" Remove Page Trailer -- gets rid of page numbers
  8. .rm PT
  9. .ll 6.375i
  10. .nr LL 6.375i   \" set Line Length
  11. .po 1.0625i
  12. .nr PO 1.0625i  \" set Page Offset (left margin)
  13. .TL
  14. The KISS TNC:
  15. A simple Host-to-TNC communications protocol
  16. .AU
  17. Mike Chepponis, K3MC
  18. .AU
  19. Phil Karn, KA9Q
  20. .AB
  21. The KISS\**
  22. .FS
  23. "Keep It Simple, Stupid"
  24. .FE
  25. TNC provides direct computer to
  26. TNC communication using a simple protocol described here.  Many TNCs now
  27. implement it, including the TAPR TNC-1 and
  28. TNC-2 (and their clones), the venerable VADCG TNC, the AEA PK-232/PK-87
  29. and all
  30. TNCs in the Kantronics line.  KISS has quickly become the protocol of choice
  31. for TCP/IP operation and multi-connect BBS software.
  32. .AE
  33. .NH
  34. Introduction
  35. .PP
  36. Standard TNC software was written with human users in mind; unfortunately,
  37. commands and responses well suited for human use are ill-adapted for host
  38. computer use, and vice versa. This is especially true for multi-user
  39. servers such as bulletin boards which must multiplex data from several network
  40. connections across a single host/TNC link.  In addition, experimentation
  41. with new link level protocols is greatly hampered because there may very
  42. well be no way at all to generate or receive frames in the desired format
  43. without reprogramming the TNC.
  44. .PP
  45. The KISS TNC solves these problems by eliminating as much as possible from
  46. the TNC software, giving the attached host complete control over and access
  47. to the contents of the HDLC frames transmitted and received over the air.
  48. This is central to the KISS philosophy: the host software should have control
  49. over all TNC functions at the lowest possible level.
  50. .PP
  51. The AX.25 protocol is removed entirely from the TNC, as are all command
  52. interpreters and the like.  The TNC simply converts between synchronous
  53. HDLC, spoken on the full- or half-duplex radio channel, and a special
  54. asynchronous, full duplex frame format spoken on the host/TNC link.
  55. Every frame received
  56. on the HDLC link is passed intact to the host once it has been translated to
  57. the asynchronous format; likewise, asynchronous frames from the host are
  58. transmitted on the radio channel once they have been converted to HDLC
  59. format.
  60. .PP
  61. Of course, this means that the bulk of AX.25 (or another protocol) must now be
  62. implemented on the host system. This is acceptable, however, considering the
  63. greatly increased flexibility and reduced overall complexity that comes from
  64. allowing the protocol to reside on the same machine with the applications to
  65. which it is closely coupled.
  66. .PP
  67. It should be stressed that the KISS TNC was intended only as a stopgap.
  68. Ideally, host computers would have HDLC interfaces of their own, making
  69. separate TNCs unnecessary. [15] Unfortunately, HDLC interfaces are rare,
  70. although they are starting to appear for the IBM PC.  The KISS TNC therefore
  71. becomes the "next best thing" to a real HDLC interface, since the host
  72. computer only needs an ordinary asynchronous interface.
  73. .NH
  74. Asynchronous Frame Format
  75. .PP
  76. The "asynchronous packet protocol" spoken between the host and TNC is very
  77. simple, since its only function is to delimit frames. Each frame is both
  78. preceded and followed by a special FEND (Frame End) character, analogous to
  79. an HDLC flag.  No CRC or checksum is provided.  In addition, no RS-232C
  80. handshaking signals are employed.
  81. .PP
  82. The special characters are:
  83. .PP
  84. .TS
  85. center box tab(/);
  86. l l l .
  87. Abbreviation/Description/Hex value
  88. =
  89. FEND/Frame End/C0
  90. FESC/Frame Escape/DB
  91. TFEND/Transposed Frame End/DC
  92. TFESC/Transposed Frame Escape/DD
  93. .TE
  94. .PP
  95. The reason for both preceding and ending frames with FENDs is to improve
  96. performance when there is noise on the asynch line.  The FEND at the
  97. beginning of a frame serves to "flush out" any accumulated garbage into a
  98. separate frame (which will be discarded by the upper layer protocol) instead
  99. of sticking it on the front of an otherwise good frame.
  100. As with back-to-back flags in
  101. HDLC, two FEND characters in a row should not be interpreted as delimiting
  102. an empty frame.
  103. .NH
  104. Transparency
  105. .PP
  106. Frames are sent in 8-bit binary; the asynchronous link is set to
  107. 8 data bits, 1 stop bit, and no parity.
  108. If a FEND ever appears in the data, it is
  109. translated into the two byte sequence FESC TFEND (Frame Escape, Transposed
  110. Frame End).  Likewise, if the FESC character ever appears in the user data,
  111. it is replaced with the two character sequence FESC TFESC (Frame Escape,
  112. Transposed Frame Escape).
  113. .PP
  114. As characters arrive at the receiver, they are appended to a buffer
  115. containing the current frame.  Receiving a FEND marks the end of the current
  116. frame.  Receipt of a FESC puts the receiver into "escaped mode",
  117. causing the receiver to translate a following TFESC or TFEND back to FESC or
  118. FEND, respectively, before adding it to the receive buffer and leaving
  119. escaped mode.  Receipt of any character other than TFESC or TFEND while in
  120. escaped mode is an error; no action is taken and frame assembly continues.
  121. A TFEND or TESC received while not in escaped mode is treated as an ordinary
  122. data character.
  123. .PP
  124. This procedure may seem somewhat complicated, but it is easy to implement
  125. and recovers quickly from errors. In particular, the FEND character is never
  126. sent over the channel except as an actual end-of-frame indication. This
  127. ensures that any intact frame (properly delimited by FEND characters) will
  128. always be received properly regardless of the starting state of the receiver
  129. or corruption of the preceding frame.
  130. .PP
  131. This asynchronous framing protocol is identical to "SLIP" (Serial Line IP),
  132. a popular method for sending ARPA IP datagrams across asynchronous links. It
  133. could also form the basis of an asynchronous amateur packet radio
  134. link protocol that avoids the complexity of HDLC on slow speed channels.
  135. .NH
  136. Control of the KISS TNC
  137. .PP
  138. Each asynchronous data frame sent to the TNC is converted back into "pure"
  139. form and queued for transmission as a separate HDLC frame.  Although
  140. removing the human interface and the AX.25 protocol from the TNC makes most
  141. existing TNC commands unnecessary (i.e., they become host functions), the
  142. TNC is still responsible for keying the transmitter's PTT line and deferring
  143. to other activity on the radio channel. It is therefore necessary to allow
  144. the host to control a few TNC parameters, namely the transmitter keyup delay,
  145. the transmitter persistence variables and any special hardware that a
  146. particular TNC may have.
  147. .PP
  148. To distinguish between command and data frames on the host/TNC link,
  149. the first byte of each
  150. asynchronous frame between host and TNC is a "type" indicator.  This type
  151. indicator byte is broken into two 4-bit nibbles so that the low-order
  152. nibble indicates the command number (given in the table below) and the
  153. high-order nibble indicates the port number for that particular command.
  154. In systems with only one HDLC port, it is by definition Port 0.  In multi-port
  155. TNCs, the upper 4 bits of the type indicator byte can specify one of up to
  156. sixteen ports.  The following commands are defined in frames to the TNC  (the
  157. "Command" field is in hexadecimal):
  158. .PP
  159. .TS
  160. box expand tab(/);
  161. l l l .
  162. Command/Function/Comments
  163. =
  164. 0/Data frame/T{
  165. The rest of the frame is data to be sent on the HDLC channel.
  166. T}
  167. _
  168. 1/TXDELAY/T{
  169. The next byte is the transmitter keyup
  170. delay in 10 ms units.
  171. The default start-up value is 50 (i.e., 500 ms).
  172. T}
  173. _
  174. 2/P/T{
  175. The next byte is the persistence parameter, p, scaled to the
  176. range 0 - 255 with the following formula:
  177. .sp
  178. $ P = p * 256 - 1 $
  179. .sp
  180. The default value is P = 63 (i.e., p = 0.25).
  181. T}
  182. _
  183. 3/SlotTime/T{
  184. The next byte is the slot interval in 10 ms units.
  185. The default is 10 (i.e., 100ms).
  186. T}
  187. _
  188. 4/TXtail/T{
  189. The next byte is the time to hold up the TX after the FCS
  190. has been sent, in 10 ms units.  This command is obsolete,
  191. and is included here only for compatibility with some existing
  192. implementations.
  193. T}
  194. _
  195. 5/FullDuplex/T{
  196. The next byte is 0 for half duplex, nonzero for full
  197. duplex. The default is 0 (i.e., half duplex).
  198. T}
  199. _
  200. 6/SetHardware/T{
  201. Specific for each TNC.  In the TNC-1, this command
  202. sets the modem speed.  Other implementations may use this
  203. function for other hardware-specific functions.
  204. T}
  205. _
  206. FF/Return/T{
  207. Exit KISS and return control to a
  208. higher-level program.  This is useful only when
  209. KISS is incorporated into the TNC along with other
  210. applications.
  211. T}
  212. .TE
  213. .PP
  214. The following types are defined in frames to the host:
  215. .TS
  216. box expand tab(/);
  217. l l l .
  218. Type/Function/Comments
  219. =
  220. 0/Data frame/T{
  221. Rest of frame is data from the HDLC channel
  222. T}
  223. .TE
  224. .PP
  225. No other types are defined; in particular, there is no provision for
  226. acknowledging data or command frames sent to the TNC.
  227. KISS implementations must ignore any unsupported command types.
  228. All KISS implementations must implement commands 0,1,2,3 and 5; the others
  229. are optional.
  230. .NH
  231. Buffer and Packet Size Limits
  232. .PP
  233. One of the things that makes the KISS TNC simple is the deliberate lack of
  234. TNC/host flow control. The host computers run a higher level protocol
  235. (typically TCP, but AX.25 in the connected mode also qualifies)
  236. that handles flow control on an end-to-end basis.  Ideally,
  237. the TNC would always have more buffer memory than the sum of all the flow
  238. control windows of all of the logical connections using it at
  239. that moment. This would allow for the worst case (i.e., all users sending
  240. simultaneously).  In practice, however, many (if not most) user connections
  241. are idle for long periods of time, so buffer memory may be safely
  242. "overbooked".  When the occasional "bump" occurs, the TNC must drop the
  243. packet gracefully, i.e., ignore it without crashing or losing packets
  244. already queued.  The higher level protocol is expected to recover by
  245. "backing off" and retransmitting the packet at a later time, just as it does
  246. whenever a packet is lost in the network for any other reason.  As long as
  247. this occurs infrequently, the performance degradation is slight; therefore
  248. the TNC should provide as much packet buffering as possible, limited only by
  249. available RAM.
  250. .PP
  251. Individual packets at least 1024 bytes long should be allowed.  As with
  252. buffer queues, it is recommended that no artificial limits be placed on
  253. packet size.  For example, the K3MC code running on a TNC-2 with 32K of RAM
  254. can send and receive 30K byte packets, although this is admittedly rather
  255. extreme.  Large packets reduce protocol overhead on good channels. They are
  256. essential for good performance when operating on high speed modems such as
  257. the new WA4DSY 56 kbps design.
  258. .PP
  259. .NH
  260. Persistence
  261. .PP
  262. The P and SlotTime parameters are used to implement true p-persistent CSMA.
  263. This works as follows:
  264. .PP
  265. Whenever the host queues data for transmission, the TNC begins monitoring
  266. the carrier detect signal from the modem. It waits indefinitely for this
  267. signal to go inactive. When the channel clears, the TNC generates a random
  268. number between 0 and 1.\**
  269. .FS
  270. To conform to the literature, here $p$ takes on values between
  271. 0 to 1. However, fractions are difficult to use in a fixed point
  272. microprocessor so the KISS TNC actually works with $P$ values that are
  273. rescaled to the range 0 to 255.
  274. To avoid confusion, we will use lower-case $p$ to mean the former (0-1)
  275. and upper-case $P$ whenever we mean the latter (0-255).
  276. .FE
  277. If this number is less than or equal to the
  278. parameter $p$, the TNC keys the transmitter, waits .01 * TXDELAY seconds,
  279. and
  280. transmits all queued frames. The TNC then unkeys the transmitter and goes
  281. back to the idle state.  If the random number is greater than $p$, the TNC
  282. delays .01 * SlotTime seconds and repeats the procedure beginning with the
  283. sampling of the carrier detect signal. (If the carrier detect signal has
  284. gone active in the meantime, the TNC again waits for it to clear before
  285. continuing).  Note that $p = 1$ means "transmit as soon as the channel
  286. clears"; in this case the p-persistence algorithm degenerates into the
  287. 1-persistent CSMA generally used by conventional AX.25 TNCs.
  288. .PP
  289. p-persistence causes the TNC to wait for an exponentially-distributed random
  290. interval after sensing that the channel has gone clear before attempting to
  291. transmit. With proper tuning of the parameters $p$ and SlotTime, several
  292. stations with traffic to send are much less likely to collide with each
  293. other when they all see the channel go clear.  One transmits first and the
  294. others see it in time to prevent a collision, and the channel remains stable
  295. under heavy load.  See references [1] through [13] for details.
  296. .PP
  297. We believe that optimum $p$ and SlotTime values could be computed
  298. automatically.  This could be done by noting the channel occupancy and the
  299. length of the frames on the channel.  We are proceeding with a simulation of
  300. the p-persistence algorithm described here that we hope will allow us to
  301. construct an automatic algorithm for $p$ and SlotTime selection.
  302. .PP
  303. We added p-persistence to the KISS TNC because it was a convenient opportunity
  304. to do so.
  305. However, it is not inherently associated with KISS nor with new protocols such
  306. as TCP/IP.
  307. Rather, persistence is a \fIchannel access\fR protocol that can yield dramatic
  308. performance improvements regardless of the higher level protocol in use;
  309. we urge it be added to \fIevery\fR TNC, whether or not it supports KISS.
  310. .NH
  311. Implementation History
  312. .PP
  313. The original idea for a simplified host/TNC protocol is due to Brian Lloyd,
  314. WB6RQN.  Phil Karn, KA9Q, organized the specification and submitted an
  315. initial version on 6 August 1986.  As of this writing, the following
  316. KISS TNC implementations exist:
  317. .PP
  318. .TS
  319. box expand tab (/);
  320. l l l .
  321. TNC type/Author/Comments
  322. =
  323. TAPR TNC-2 & clones/Mike Chepponis, K3MC/T{
  324. First implementation, most widely
  325. used. Exists in both downloadable
  326. and dedicated ROM versions.
  327. T}
  328. _
  329. TAPR TNC-1 & clones/Marc Kaufman, WB6ECE/T{
  330. Both download and dedicated ROM
  331. versions.
  332. T}
  333. _
  334. VADCG TNC & Ashby TNC/Mike Bruski, AJ9X/Dedicated ROM.
  335. _
  336. AEA PK-232 & PK-87/Steve Stuart, N6IA/T{
  337. Integrated into standard AEA
  338. firmware as of 21 January 1987.
  339. The special commands "KISS ON"
  340. and "KISS OFF" (!) control entry
  341. into KISS mode.
  342. T}
  343. _
  344. Kantronics/Mike Huslig/T{
  345. Integrated into standard Kantronics
  346. firmware as of July 1987.
  347. T}
  348. .TE
  349. .PP
  350. The AEA and Kantronics implementations are noteworthy in that the KISS
  351. functions were written by those vendors and integrated into their standard
  352. TNC firmware. Their TNCs can operate in either KISS or regular AX.25 mode
  353. without ROM changes.  Since the TNC-1 and TNC-2 KISS versions were written
  354. by different authors than the original AX.25 firmware, and because the
  355. original source code for those TNCs was not made available, running KISS on
  356. these TNCs requires the installation of nonstandard ROMs. Two ROMs are
  357. available for the TNC-2. One contains "dedicated" KISS TNC code; the TNC
  358. operates only in the KISS mode. The "download" version contains standard
  359. N2WX firmware with a bootstrap loader overlay. When the TNC is turned on 
  360. or reset, it executes the loader. The loader will accept a memory image in
  361. Intel Hex format, or it can be told to execute the standard N2WX firmware
  362. through the "H"\** command.  The download version is handy for
  363. .FS
  364. For "Howie", of course.
  365. .FE
  366. occasional KISS operation, while the dedicated version is much more
  367. convenient for full-time or demo KISS operation.
  368. .PP
  369. The code for the TNC-1 is also available in both download and dedicated
  370. versions. However, at present the download ROM contains only a bootstrap;
  371. the original ROMs must be put back in to run the original TNC software.
  372. .NH
  373. Credits
  374. .PP
  375. The combined "Howie + downloader" ROM for the TNC-2 was contributed by
  376. WA7MXZ.
  377. This document was carefully typeset by Bob Hoffman, N3CVL.
  378. .PP
  379. .NH
  380. Bibliography
  381. .PP
  382. .IP 1.
  383. Tanenbaum, Andrew S., "Computer Networks"   pp. 288-292.
  384. Prentice-Hall  1981.
  385. .IP 2.
  386. Tobagi, F. A.: "Random Access Techniques for Data Transmission over
  387. Packet Switched Radio Networks," Ph.D. thesis, Computer Science
  388. Department, UCLA, 1974.
  389. .IP 3.
  390. Kleinrock, L., and Tobagi, F.: "Random Access Techniques for Data
  391. Transmission over Packet-Switched Radio Channels," Proc. NCC,
  392. pp. 187-201, 1975.
  393. .IP 4.
  394. Tobagi, F. A., Gerla, M., Peebles, R.W., and Manning, E.G.: "Modeling
  395. and Measurement Techniques in Packet Communications Networks," Proc.
  396. IEEE, vol. 66, pp. 1423-1447, Nov. 1978.
  397. .IP 5.
  398. Lam, S. S.: "Packet Switching in a Multiaccess Broadcast Channel",
  399. Ph.D. thesis, Computer Science Department, UCLA, 1974.
  400. .IP 6.
  401. Lam, S. S., and Kleinrock, L.: "Packet Switching in a Multiaccess
  402. Broadcast Channel:  Dynamic Control Procedures," IEEE Trans. Commun.,
  403. vol COM-23, pp. 891-904, Sept. 1975.
  404. .IP 7.
  405. Lam, S. S.: "A Carrier Sense Multiple Access Protocol for Local
  406. Networks,"  Comput. Networks, vol 4, pp. 21-32, Feb. 1980
  407. .IP 8.
  408. Tobagi, F. A.: "Multiaccess Protocols in Packet Communications
  409. Systems," IEEE Trans. Commun., vol COM-28, pp. 468-488, April 1980c.
  410. .IP 9.
  411. Bertsekas, D., and Gallager, R.: "Data Networks", pp. 274-282
  412. Prentice-Hall 1987.
  413. .IP 10.
  414. Kahn, R. E., Gronemeyer, S. A., Burchfiel, J., and Kungelman, R. C.
  415. "Advances in Packet Radio Technology," Proc. IEEE.  pp. 1468-1496.  1978.
  416. .IP 11.
  417. Takagi, H.: "Analysis of Polling Systems," Cambridge, MA
  418. MIT Press 1986.
  419. .IP 12.
  420. Tobagi, F. A., and Kleinrock, L. "Packet Switching in Radio Channels:
  421. Part II - The Hidden Terminal Problem in CSMA and Busy-Tone Solution,"
  422. IEEE Trans. Commun.  COM-23 pp. 1417-1433.  1975.
  423. .IP 13.
  424. Rivest, R. L.: "Network Control by Bayessian Broadcast," Report
  425. MIT/LCS/TM-285.  Cambridge, MA.  MIT, Laboratory for Computer Science.
  426. 1985.
  427. .IP 14.
  428. Karn, P. and Lloyd, B.: "Link Level Protocols Revisited," ARRL Amateur Radio
  429. Fifth Computer Networking Conference, pp. 5.25-5.37, Orlando, 9 March 1986.
  430. .IP 15.
  431. Karn, P., "Why Do We Even Need TNCs Anyway", Gateway, vol. 3 no. 2, September
  432. 5, 1986.
  433.  
  434.